/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ${USER}
 * Date: ${YEAR}-${MONTH}-${DAY}
 * Time: ${TIME}
 */
class A{
    public String name;
    //父类构造方法
    public A(String name){
        this.name = name;
    }

}
class B extends A{
    public String name;
    //系统默认构造方法如下
    public B(String name){
        super(name);//调用父类构造方法，此时子类还未初始化
        func();//打印子类name的值
        this.name = name;
    }
     void func(){
         System.out.println("子类初始化前：" + name);
     }
    public void test(){
        System.out.println(super.name);
    }
}
public class Main {
    public static void main(String[] args) {
        B b = new B("B");
        System.out.println(b.name);
        b.test();//初始化完成父类的值
    }
}